import os
import random
import sys
from datetime import datetime, timedelta

import django

base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'mobiledj_Security.settings')
django.setup()
from web import models

print(random.randint(0, 100000))
today = datetime.now()
for i in range(0, 30):
    date = today - timedelta(days=i)
    models.K01.objects.create(
        atk_count=random.randint(0, 100000),
        atkip_count=random.randint(0, 1000),
        outgoing_count=random.randint(0, 100),
        create_datetime=date,
        update_datetime=date
    )

# for i in range(1, 300):
#     models.Users.objects.create(
#         role=2,
#         username='xxsdongj%s' % i,
#         nickname='董金%s' % i,
#         password=md5('ta891qhs'),
#         active=1
#     )
